<?php
namespace app\user\model;
use think\Db;
use think\Model;

class Order extends Model {
	public function getStatusAttr($value) {

		$status = [-1 => '取消', 0 => '预约中', 1 => '完成'];
		return $status[$value];
	}
	public function getCarIdAttr($value, $data) {
		$carPic = Db::name('car')->where('id', $data['car_id'])->value('pic');
		$carBrand = Db::name('car')->where('id', $data['car_id'])->value('brand');
		$carDesc = Db::name('car')->where('id', $data['car_id'])->value('desc');

		$arr = ['pic' => $carPic, 'brand' => $carBrand, 'desc' => $carDesc];

		return $arr;
	}
	public function getBorrowCityAttr($value)
	{
		$arr  = ['BJ'=>'北京','SH'=>'上海'];
		return $arr[$value];
	}
		public function getReturnCityAttr($value)
	{
		$arr  = ['BJ'=>'北京','SH'=>'上海'];
		return $arr[$value];
	}

}